/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package helper;

/**
 *
 * @author Not Stephen
 */
public class DateProcess {
    public static String correctDate(String date){
        String correctDate = "";
        //04 / 05 / 2013
        //01 2 34 5 6789
        String month = date.trim().substring(0,2);
        String day = date.trim().substring(3,5);
        String year = date.trim().substring(6);
        correctDate = year + "-" + month + "-" + day;
        return correctDate;
    }
    public static String formatDate(String date) {
        String formattedDate = "";
        //2013 - 05 - 06 (Date)
        //0123 4 56 7 89
        //May 06, 2013 (formattedDate)
        String year = date.trim().substring(0, 4);
        int month = Integer.parseInt(date.trim().substring(5, 7));
        String day = date.trim().substring(8);
        String newMonth = "";
        switch (month) {
            case 1:
                newMonth = "January";
                break;
            case 2:
                newMonth = "February";
                break;
            case 3:
                newMonth = "March";
                break;
            case 4:
                newMonth = "April";
                break;
            case 5:
                newMonth = "May";
                break;
            case 6:
                newMonth = "June";
                break;
            case 7:
                newMonth = "July";
                break;
            case 8:
                newMonth = "August";
                break;
            case 9:
                newMonth = "September";
                break;
            case 10:
                newMonth = "October";
                break;
            case 11:
                newMonth = "November";
                break;
            case 12:
                newMonth = "December";
                break;
        }
        formattedDate = newMonth + " " + day + ", " + year;
        return formattedDate;
    }
}
